<%@ page language="java" errorPage="/CustomError.jsp" pageEncoding="UTF-8"%>

<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%
	String path = request.getContextPath();
	String entityKey = (String)request.getAttribute("entityKey");

%>
<html:html locale="true">
  <head>
  
  <html:base />
	<title>
	 <bean:message key="uploadfile.jsp" /> 
	</title>
  <html:base />
  	<script type='text/javascript' src='<%=request.getContextPath()%>/include/lib/common.js'></script>
  	<script type='text/javascript' src='<%=request.getContextPath()%>/include/lib/utils.js'></script>
  	<script language="javascript">
	
	window.onload = function()
	{
		var dataLayoutType = 0;
		var entityKey = document.all.entityKey.value;
		if(entityKey == "") 
			dataLayoutType = 1;
		<% 	if("BICCODE".equalsIgnoreCase(entityKey)) {    %> 
			clearCombo("codetype");
	        var codeTypeObj  = new AJAXCall("toModule.do?prefix=/jsp/Commons&page=/general.do?typeid=<%=""%>&productIdAppend=Y" + appendTokenId(),fillCombo,"codetype",document.all.codeType.value,"");
	 	    codeTypeObj.doGet();
	   <%}%>
		
		var datalayoutidObj = new AJAXCallWithStatusImage("toModule.do?prefix=<%=request.getAttribute("mastersPrefix")%>&page=/datalayout.do&method=list&listtype=authorized&upload=Y" + appendTokenId(),fillCombo,"datalayoutname", document.all.datalayoutid.value,"dataImage");
		datalayoutidObj.doGet();	
			
	}
	 	// Cancel link pointing to the authorised page
		
		// It will be used when cancel button is clicked
		var bCancel = false;
		
		function validateInputForm(form)
		{
			if(bCancel) 
			{
				var entityKey = document.all.entityKey.value;
				var cancelLink = "toModule.do?prefix=<%=(String)request.getAttribute("listingPrefix")%>&page=/"+entityKey.toLowerCase()+"list.do&type=<%=request.getParameter("type")%>" + appendTokenId();
				window.location.href = cancelLink;
				return false;
			}
			else 
			{
				return frmSubmit();
				return true;
			}
		}
		function onchange_codeType()
		{
			document.all.codeType.value=document.all.codetype.options[document.all.codetype.selectedIndex].value;
		}
		
		function onchange_datalayout()
		{
			document.all.datalayoutid.value=document.all.datalayoutname.options[document.all.datalayoutname.selectedIndex].value;
		}
		function frmSubmit()
		{    
		    <% 	if("BICCODE".equalsIgnoreCase(entityKey)) {    %> 
		    if(!checkCombo(document.all.codetype))
				return false;
				 <%}%>
			if(!checkCombo(document.all.datalayoutname))
				return false;
			
			if(!checkIsNull(document.all.myFile))
				return false;	
				
			return true; 
		}
</script>		
  </head>
  	<body class="bg">
  		<html:form  action="/upload" enctype="multipart/form-data"  onsubmit="return validateInputForm(this)"  >
  		<table width="100%" border="0" cellpadding="0" cellspacing="1" class="tablebg" >
		  	<tr>
		  		<td>
					<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center" class="tablebg">
							<tr class="tablebg">
								<td  class="boldtext"><b><bean:message key="upload.screen"/></b></td>	               
							</tr>
					</table>
					
					<table width="100%"  border="0" cellpadding="0" cellspacing="0">
						<tr align="center" class="tblRow">
							<td colspan="5">
								<br>
								<fieldset id="fstAddress" class="fststyle"> 
									<legend><bean:message key="upload.details" /></legend>
									<table width="100%" border="0" cellspacing="0" cellpadding="1" class="tablebg">
									<%
										 			if("BICCODE".equalsIgnoreCase(entityKey)) {
										 			%>
									<tr class="tblRow">
											<td class="textcolor">
												&nbsp;
												 <bean:message key="upload.codetype" />
											</td>
											<td class="textcolor">
                                             <TABLE cellspacing="0">
                                               <TR>
											
											     <td>
											     <div id="dropdown">
												<select id="codetype" Class="comboStylemand" onchange="javascript:onchange_codeType();" alt="Code Type">
												</select>
												
												<html:hidden property="codeType" />
												&nbsp;	<!--<font class="redFont">*</font>--></div>
												
											   </td>
												<TD>
													<DIV id="dataImage"></DIV>
												</TD>
												</TR>
   											 </TAble>
  										  </td>
  										  </tr>	
  										  	<%
										 			}
										 		%>
																				
										<tr class="tblRow">
											<td class="textcolor">
												&nbsp;
												 <bean:message key="upload.datalayoutname" />
											</td>
											<td class="textcolor">
                                             <TABLE cellspacing="0">
                                               <TR>
											
											     <td>
											     <div id="dropdown">
												<select id="datalayoutname" Class="txtinputmand" title="Data Layout Name" onchange="javascript:onchange_datalayout();">
												</select>
												<html:hidden property="datalayoutid" />
												&nbsp;<!--<font class="redFont">*</font>--></div>
												
											   </td>
												<TD>
													<DIV id="dataImage"></DIV>
												</TD>
												</TR>
   											 </TAble>
  										  </td>
  										  </tr>
										<tr  class="tblRow">
											<td align="left" class="textcolor">
												&nbsp; <bean:message key="filename" />	
											</td>
											<td>
												<html:file property="myFile" styleClass ="txtinput" alt="Upload File Name"></html:file>
											</td>
										</tr>
									</table>									
								</fieldset>	
								<br>							
							</td>
						</tr>
					</table> 
				</td>
			</tr>			
		</table>
	<BR>
	<table border="0" cellpadding="0" cellspacing="0" align="right" width="100">
		<tr>
			<td align="right">	
				<html:submit property="submit" styleClass ="buttonStyle" ><bean:message key="uplaod.button" /></html:submit>
			</td>
			<td>&nbsp;&nbsp; 
				<html:cancel styleClass="buttonStyle" property="cancel" onclick="bCancel=true">
					<bean:message key="cancel" />
				</html:cancel>
			</td>
		</tr>
	</table>
	<html:hidden property="method" value="processUpload" />
	<html:hidden property="entityKey" />
	<html:hidden property="bankId" />
	<html:hidden property="corporateId" />
	<html:hidden property="id" />
	<html:hidden property="version" />
	<html:hidden property="requestby" />
	<html:hidden property="modifiedBy" />
	<html:hidden property="modifiedSysOn"/>
	<html:hidden property="modifiedOn" />
	<html:hidden property="modifiedAtOU" />
	<html:hidden property="effectiveFrom" />
	<input type="hidden" name="userTokenId" id="userTokenId" value="">
	
</html:form>   
</body>  
</html:html>



